Skip to main content

Escrow

Query Messages

note

We will only go through the queries for this contract, as users are not allowed to execute any messages on the Escrow contract directly. You can read about the Escrow architecture here

List of queries that can be performed on the Escrow contract.

State

Queries the state of the contract for information such as the stored token and the amount.

pub enum QueryMsg {
    #[returns(StateResponse)]
    State {},
{"state":{}}

The query returns the following response:

#[cw_serde]
pub struct StateResponse {
pub token: Token,
pub factory_address: Addr,
pub total_amount: Uint128,
}
NameTypeDescription
tokenTokenThe token Id of the token stored in the escrow.
factory_addressAddrContract address of the factory contract deployed on the same chain.
total_amountUint128Total amount of tokens stored in the escrow.

TokenId

Queries the token Id of the token being held in the escrow.

pub enum QueryMsg {
    #[returns(TokenIdResponse)]
    TokenId {},
}
{"token_id":{}}

The query returns the following response:

pub struct TokenIdResponse {
pub token_id: String,
}
NameTypeDescription
token_idStringThe unique Id for the token type held in the escrow.

TokenAllowed

Checks if the specified token is allowed to be stored in this escrow.

pub enum QueryMsg {
    #[returns(AllowedTokenResponse)]
    TokenAllowed { denom: TokenType },
}
JSON Example: 
{
  "token_allowed": {
    "denom": {
      "native": {
        "denom": "osmo"
      }
    }
  }
}

 

NameTypeDescription
denomTokenTypeThe type of token. Returns the denom for native and CW20 contract address for CW20 token.

The query returns the following response:


pub struct AllowedTokenResponse {
pub allowed: bool,
}
NameTypeDescription
allowedboolSet to true if the specified token is allowed in this escrow and false otherwise.

AllowedDenoms

Queries all the tokens allowed to be stored in the escrow.

pub enum QueryMsg {
     #[returns(AllowedDenomsResponse)]
    AllowedDenoms {},
}
JSON Example: 
{
  "allowed_denoms": {}
}

The query returns the following response:

pub struct AllowedDenomsResponse {
pub denoms: Vec<TokenType>,
}
NameTypeDescription
denomsVec<TokenType>A list of allowed tokens along with their types .